############################################################################# #check bivariate normality #quadratic form # t((x-mu))S^(-1)(x-mu) <= qchisq(0.5,df=2) # input: mu - vector of means # S - var-cov matrix # x - one bivarivariate data point # output: text saying that data are normal or not ############################################################################# checkNormallity=function(mu=c(155.6,14.7),S=matrix(c(7476.45,303.62,303.62,26.19),nrow=2),x=c(108.28,17.05)){ QuadraticForm=t(x-mu)%*% solve(S) %*% (x-mu) if (QuadraticForm <= qchisq(0.5,df=2)) { msg="Data normally distributed" }else{ msg="Data not normally distributed" } return(msg) } ############################################################################# #call the function with default input parameters checkNormallity() #############################################################################